using System;
using System.Data.Common;
using System.Data.Odbc;
using System.Data.SqlClient;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Be.Timvw.Framework.Data.Tests.DbProviderFactoryHelper
{
    [TestClass]
    public class WhenGettingDbConnection
    {
        [TestMethod]
        public void ShouldReturnSqlConnectionWithSqlClientConnectionStringName()
        {
            using(DbConnection dbConnection = Data.DbProviderFactoryHelper.GetDbConnection("SqlClientConnectionStringName"))
            {
                Type actual = dbConnection.GetType();

                Type expected = typeof(SqlConnection);

                Assert.AreEqual(expected, actual);
            }
        }

        [TestMethod]
        public void ShouldReturnOdbcConnectionWithOdbcConnectionStringName()
        {
            using(DbConnection dbConnection = Data.DbProviderFactoryHelper.GetDbConnection("OdbcConnectionStringName"))
            {
                Type actual = dbConnection.GetType();

                Type expected = typeof(OdbcConnection);

                Assert.AreEqual(expected, actual);
            }
        }
    }
}